package com.jwd.avmanager.test;

import com.alibaba.fastjson.JSONObject;
import com.jwd.avmanager.util.DebugLogger;
import com.jwd.avmanager.util.JsonUtils;
import com.microsoft.sqlserver.jdbc.StringUtils;

public class text {
    public static void main(String[] args) {
        String mag = "[{\"UserID\":\"12\"},{\"cmd\":\"21249\"},{\"value\":\"1,48,0\"}]";
        boolean json = JsonUtils.isJsonValid(mag);
        DebugLogger.info(json);
    }

    public static boolean isJson(String json) {
        if (StringUtils.isEmpty(json)) {
            return false;
        }
        boolean isJsonObject = true;
        try {
            JSONObject.parseObject(json);
        } catch (Exception e) {
            isJsonObject = false;
        }
        //不是json格式
        return isJsonObject;
    }
}